<template>
  <div id="app">
    <transition :name="transitionName">
       <router-view class="child-view"/>
    </transition>
  </div>
</template>
<script>
export default {
  name: "app",
  data() {
    return {
      transitionName: "slide-left"
    };
  },
  mounted() {},
  //监听路由的路径，可以通过不同的路径去选择不同的切换效果
  watch: {
    $route(to) {
      console.log(to);
      if (to.path == "/") {
        this.transitionName = "slide-right";
      } else {
        this.transitionName = "slide-left";
      }
    }
  }
};
</script>

<style lang="less" scoped>
/* 引入公共样式 */
@import "./style/common.css";
#app {
  width: 100%;
  height: 100%;
}
#home_box {
  height: 100%;
}
.mint-tab-container {
  height: 100%;
  overflow: scroll;
}
.mint-tab-container-wrap {
  height: 100%;
  overflow: scroll;
}
.child-view {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  transition: all 0.5s cubic-bezier(0.55, 0, 0.1, 1);
}
.slide-left-enter,
.slide-right-leave-active {
  opacity: 0;
  -webkit-transform: translate(50px, 0);
  transform: translate(50px, 0);
}
.slide-left-leave-active,
.slide-right-enter {
  opacity: 0;
  -webkit-transform: translate(-50px, 0);
  transform: translate(-50px, 0);
}
</style>
